{
 "metadata": {
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.5-final"
  },
  "orig_nbformat": 2,
  "kernelspec": {
   "name": "python3",
   "display_name": "Python 3",
   "language": "python"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2,
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 78,
   "metadata": {},
   "outputs": [
    {
     "output_type": "stream",
     "name": "stdout",
     "text": [
      "     停役   日期   计划批准时间         停役~复役             厂、站名称  \\\n0 2021-03-01                                            \n1 2021-03-01             8:00-16:00           湖新44F3线   \n2 2021-03-01          07:00-8日16:00           钱晓5P32线   \n3 2021-03-01            06:30-18:00  乐冬青1373线、东乐1986线   \n4 2021-03-01            06:30-18:00           乐青1374线   \n5 2021-03-01            06:30-18:00               新乐变   \n\n    主    要    工    作    内    容  申请单位   备注   申请单编号  \n0                                                  \n1                         线路退役  输电中心       221012  \n2             1）线路C检；2）复合绝缘子更换    省检       221020  \n3                        线路退役。  电缆中心  B基建  210327  \n4                        线路退役。  电缆中心  B基建  210328  \n5  东乐1986线、乐冬1373线、乐青1374间隔退役。  电缆中心  B基建  210329  \n<class 'pandas.core.frame.DataFrame'>\nRangeIndex: 118 entries, 0 to 117\nData columns (total 7 columns):\n #   Column                      Non-Null Count  Dtype         \n---  ------                      --------------  -----         \n 0   停役   日期                     118 non-null    datetime64[ns]\n 1     计划批准时间         停役~复役      118 non-null    object        \n 2   厂、站名称                       118 non-null    object        \n 3   主    要    工    作    内    容  118 non-null    object        \n 4   申请单位                        118 non-null    object        \n 5   备注                          118 non-null    object        \n 6   申请单编号                       118 non-null    object        \ndtypes: datetime64[ns](1), object(6)\nmemory usage: 6.6+ KB\nNone\n"
     ]
    }
   ],
   "source": [
    "import pandas as pd\n",
    "import datetime\n",
    "import numpy as np\n",
    "path = r'/Users/tangjx/Documents/python/file_tools/生产计划管理/周计划/周计划 2021年3月1日-3月7日.xlsx'\n",
    "df = pd.read_excel(path,sheet_name='Sheet1',keep_default_na = False)\n",
    "print(df.head(6))\n",
    "print(df.info())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 79,
   "metadata": {},
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": [
       "     停役   日期   计划批准时间         停役~复役             厂、站名称  \\\n",
       "1 2021-03-01             8:00-16:00           湖新44F3线   \n",
       "2 2021-03-01          07:00-8日16:00           钱晓5P32线   \n",
       "3 2021-03-01            06:30-18:00  乐冬青1373线、东乐1986线   \n",
       "4 2021-03-01            06:30-18:00           乐青1374线   \n",
       "5 2021-03-01            06:30-18:00               新乐变   \n",
       "6 2021-03-01         06:30-13日16:00               东展变   \n",
       "\n",
       "                      主    要    工    作    内    容  申请单位   备注   申请单编号  \n",
       "1                                           线路退役  输电中心       221012  \n",
       "2                               1）线路C检；2）复合绝缘子更换    省检       221020  \n",
       "3                                          线路退役。  电缆中心  B基建  210327  \n",
       "4                                          线路退役。  电缆中心  B基建  210328  \n",
       "5                    东乐1986线、乐冬1373线、乐青1374间隔退役。  电缆中心  B基建  210329  \n",
       "6  东乐1986间隔设备预试、维护，保护测控校验，消缺、反措、精益化检查及整改；二次专业排雷。  检修中心    B  210330  "
      ],
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>停役   日期</th>\n      <th>计划批准时间         停役~复役</th>\n      <th>厂、站名称</th>\n      <th>主    要    工    作    内    容</th>\n      <th>申请单位</th>\n      <th>备注</th>\n      <th>申请单编号</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>1</th>\n      <td>2021-03-01</td>\n      <td>8:00-16:00</td>\n      <td>湖新44F3线</td>\n      <td>线路退役</td>\n      <td>输电中心</td>\n      <td></td>\n      <td>221012</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>2021-03-01</td>\n      <td>07:00-8日16:00</td>\n      <td>钱晓5P32线</td>\n      <td>1）线路C检；2）复合绝缘子更换</td>\n      <td>省检</td>\n      <td></td>\n      <td>221020</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>2021-03-01</td>\n      <td>06:30-18:00</td>\n      <td>乐冬青1373线、东乐1986线</td>\n      <td>线路退役。</td>\n      <td>电缆中心</td>\n      <td>B基建</td>\n      <td>210327</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>2021-03-01</td>\n      <td>06:30-18:00</td>\n      <td>乐青1374线</td>\n      <td>线路退役。</td>\n      <td>电缆中心</td>\n      <td>B基建</td>\n      <td>210328</td>\n    </tr>\n    <tr>\n      <th>5</th>\n      <td>2021-03-01</td>\n      <td>06:30-18:00</td>\n      <td>新乐变</td>\n      <td>东乐1986线、乐冬1373线、乐青1374间隔退役。</td>\n      <td>电缆中心</td>\n      <td>B基建</td>\n      <td>210329</td>\n    </tr>\n    <tr>\n      <th>6</th>\n      <td>2021-03-01</td>\n      <td>06:30-13日16:00</td>\n      <td>东展变</td>\n      <td>东乐1986间隔设备预试、维护，保护测控校验，消缺、反措、精益化检查及整改；二次专业排雷。</td>\n      <td>检修中心</td>\n      <td>B</td>\n      <td>210330</td>\n    </tr>\n  </tbody>\n</table>\n</div>"
     },
     "metadata": {},
     "execution_count": 79
    }
   ],
   "source": [
    "df.drop(index = df[df['厂、站名称']==''].index,inplace=True)\n",
    "df.head(6)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 80,
   "metadata": {},
   "outputs": [
    {
     "output_type": "stream",
     "name": "stdout",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\nInt64Index: 97 entries, 1 to 117\nData columns (total 7 columns):\n #   Column                      Non-Null Count  Dtype         \n---  ------                      --------------  -----         \n 0   停役   日期                     97 non-null     datetime64[ns]\n 1     计划批准时间         停役~复役      97 non-null     object        \n 2   厂、站名称                       97 non-null     object        \n 3   主    要    工    作    内    容  97 non-null     object        \n 4   申请单位                        97 non-null     object        \n 5   备注                          97 non-null     object        \n 6   申请单编号                       97 non-null     object        \ndtypes: datetime64[ns](1), object(6)\nmemory usage: 8.6+ KB\n"
     ]
    }
   ],
   "source": [
    "df.drop(index = df[df['厂、站名称']==np.nan].index,inplace=True)\n",
    "df.info()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 81,
   "metadata": {},
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": [
       "        停役日期          停复役时间              厂站名称                       主要工作内容  \\\n",
       "1 2021-03-01     8:00-16:00           湖新44F3线                         线路退役   \n",
       "2 2021-03-01  07:00-8日16:00           钱晓5P32线             1）线路C检；2）复合绝缘子更换   \n",
       "3 2021-03-01    06:30-18:00  乐冬青1373线、东乐1986线                        线路退役。   \n",
       "4 2021-03-01    06:30-18:00           乐青1374线                        线路退役。   \n",
       "5 2021-03-01    06:30-18:00               新乐变  东乐1986线、乐冬1373线、乐青1374间隔退役。   \n",
       "\n",
       "   申请单位   备注   申请单编号  \n",
       "1  输电中心       221012  \n",
       "2    省检       221020  \n",
       "3  电缆中心  B基建  210327  \n",
       "4  电缆中心  B基建  210328  \n",
       "5  电缆中心  B基建  210329  "
      ],
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>停役日期</th>\n      <th>停复役时间</th>\n      <th>厂站名称</th>\n      <th>主要工作内容</th>\n      <th>申请单位</th>\n      <th>备注</th>\n      <th>申请单编号</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>1</th>\n      <td>2021-03-01</td>\n      <td>8:00-16:00</td>\n      <td>湖新44F3线</td>\n      <td>线路退役</td>\n      <td>输电中心</td>\n      <td></td>\n      <td>221012</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>2021-03-01</td>\n      <td>07:00-8日16:00</td>\n      <td>钱晓5P32线</td>\n      <td>1）线路C检；2）复合绝缘子更换</td>\n      <td>省检</td>\n      <td></td>\n      <td>221020</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>2021-03-01</td>\n      <td>06:30-18:00</td>\n      <td>乐冬青1373线、东乐1986线</td>\n      <td>线路退役。</td>\n      <td>电缆中心</td>\n      <td>B基建</td>\n      <td>210327</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>2021-03-01</td>\n      <td>06:30-18:00</td>\n      <td>乐青1374线</td>\n      <td>线路退役。</td>\n      <td>电缆中心</td>\n      <td>B基建</td>\n      <td>210328</td>\n    </tr>\n    <tr>\n      <th>5</th>\n      <td>2021-03-01</td>\n      <td>06:30-18:00</td>\n      <td>新乐变</td>\n      <td>东乐1986线、乐冬1373线、乐青1374间隔退役。</td>\n      <td>电缆中心</td>\n      <td>B基建</td>\n      <td>210329</td>\n    </tr>\n  </tbody>\n</table>\n</div>"
     },
     "metadata": {},
     "execution_count": 81
    }
   ],
   "source": [
    "pre_cols = df.columns\n",
    "la_cols = ['停役日期','停复役时间','厂站名称','主要工作内容','申请单位','备注','申请单编号']\n",
    "re_name ={}\n",
    "for i,j in enumerate(pre_cols):\n",
    "    re_name[j] = la_cols[i]\n",
    "df.rename(columns=re_name,inplace=True)\n",
    "df.head(5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 82,
   "metadata": {},
   "outputs": [
    {
     "output_type": "stream",
     "name": "stdout",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\nInt64Index: 97 entries, 1 to 117\nData columns (total 10 columns):\n #   Column  Non-Null Count  Dtype         \n---  ------  --------------  -----         \n 0   周计划编号   97 non-null     object        \n 1   计划停役时间  0 non-null      float64       \n 2   计划复役时间  0 non-null      float64       \n 3   停役日期    97 non-null     datetime64[ns]\n 4   停复役时间   97 non-null     object        \n 5   厂站名称    97 non-null     object        \n 6   主要工作内容  97 non-null     object        \n 7   申请单位    97 non-null     object        \n 8   备注      97 non-null     object        \n 9   申请单编号   97 non-null     object        \ndtypes: datetime64[ns](1), float64(2), object(7)\nmemory usage: 10.8+ KB\n"
     ]
    }
   ],
   "source": [
    "df.insert(0,'周计划编号',np.nan)\n",
    "x = 'chushizhi'\n",
    "k = 1\n",
    "for i in range(0,df.shape[0]):\n",
    "    temp = df.iloc[i,1].strftime('%Y%m%d')\n",
    "    if x!=temp:\n",
    "        x = temp\n",
    "        k = 1\n",
    "        y = 'ZJH'+x+str('%03d'%k)\n",
    "        df.iloc[i,0] = y\n",
    "    else:\n",
    "        k = k + 1\n",
    "        y = 'ZJH'+x+str('%03d'%k)\n",
    "        df.iloc[i,0] = y\n",
    "df.insert(1,'计划停役时间',np.nan)\n",
    "df.insert(2,'计划复役时间',np.nan)\n",
    "df.info()\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 100,
   "metadata": {},
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": [
       "            周计划编号              计划停役时间              计划复役时间       停役日期  \\\n",
       "1  ZJH20210301001 2021-03-01 08:00:00 2021-03-01 16:00:00 2021-03-01   \n",
       "2  ZJH20210301002 2021-03-01 07:00:00 2021-03-08 16:00:00 2021-03-01   \n",
       "3  ZJH20210301003 2021-03-01 06:30:00 2021-03-01 18:00:00 2021-03-01   \n",
       "\n",
       "           停复役时间              厂站名称            主要工作内容  申请单位   备注   申请单编号  \n",
       "1     8:00-16:00           湖新44F3线              线路退役  输电中心       221012  \n",
       "2  07:00-8日16:00           钱晓5P32线  1）线路C检；2）复合绝缘子更换    省检       221020  \n",
       "3    06:30-18:00  乐冬青1373线、东乐1986线             线路退役。  电缆中心  B基建  210327  "
      ],
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>周计划编号</th>\n      <th>计划停役时间</th>\n      <th>计划复役时间</th>\n      <th>停役日期</th>\n      <th>停复役时间</th>\n      <th>厂站名称</th>\n      <th>主要工作内容</th>\n      <th>申请单位</th>\n      <th>备注</th>\n      <th>申请单编号</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>1</th>\n      <td>ZJH20210301001</td>\n      <td>2021-03-01 08:00:00</td>\n      <td>2021-03-01 16:00:00</td>\n      <td>2021-03-01</td>\n      <td>8:00-16:00</td>\n      <td>湖新44F3线</td>\n      <td>线路退役</td>\n      <td>输电中心</td>\n      <td></td>\n      <td>221012</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>ZJH20210301002</td>\n      <td>2021-03-01 07:00:00</td>\n      <td>2021-03-08 16:00:00</td>\n      <td>2021-03-01</td>\n      <td>07:00-8日16:00</td>\n      <td>钱晓5P32线</td>\n      <td>1）线路C检；2）复合绝缘子更换</td>\n      <td>省检</td>\n      <td></td>\n      <td>221020</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>ZJH20210301003</td>\n      <td>2021-03-01 06:30:00</td>\n      <td>2021-03-01 18:00:00</td>\n      <td>2021-03-01</td>\n      <td>06:30-18:00</td>\n      <td>乐冬青1373线、东乐1986线</td>\n      <td>线路退役。</td>\n      <td>电缆中心</td>\n      <td>B基建</td>\n      <td>210327</td>\n    </tr>\n  </tbody>\n</table>\n</div>"
     },
     "metadata": {},
     "execution_count": 100
    }
   ],
   "source": [
    "# 获取开始时间\n",
    "def start_time(a,b):\n",
    "    c = b.split('-')\n",
    "    temp1 = int(c[0].split(':')[0])\n",
    "    temp2 = int(c[0].split(':')[1])\n",
    "    temptime = datetime.datetime(a.year,a.month,a.day,temp1,temp2,0) \n",
    "    return temptime\n",
    "\n",
    "# 获取结束时间\n",
    "def stop_time(a,b):\n",
    "    c = b.split('-')\n",
    "    temptime= datetime.datetime(1900,1,1,0,0,0)\n",
    "    # p1= b.find('日')\n",
    "    if '日' in b:\n",
    "        if '月' in b: \n",
    "            k = c[1].find('月')\n",
    "            k1 = c[1].find('日')\n",
    "            tp = c[1][k1+1:]                        \n",
    "            temp1 = int(tp.split(':')[0])#小时\n",
    "            temp2 = int(tp.split(':')[1])  #分钟                     \n",
    "            tp1 = int(c[1][0:k]) #月\n",
    "            tp2 = int(c[1][k+1:k1])#日\n",
    "            temptime = datetime.datetime(a.year,tp1,tp2,temp1,temp2,0)     \n",
    "        else:           \n",
    "            k = c[1].find('日')\n",
    "            tp = c[1][k+1:]\n",
    "            tp1 = int(c[1][0:k])#日\n",
    "            temp1 = int(tp.split(':')[0])#小时\n",
    "            temp2 = int(tp.split(':')[1])#分钟\n",
    "            temptime = datetime.datetime(a.year,a.month,tp1,temp1,temp2,0)     \n",
    "    else:          \n",
    "        temp1 = int(c[1].split(':')[0])\n",
    "        temp2 = int(c[1].split(':')[1])\n",
    "        temptime = datetime.datetime(a.year,a.month,a.day,temp1,temp2,0) \n",
    "    return temptime\n",
    "# print(stop_time(df.iloc[1,3],df.iloc[1,4])) \n",
    "df['计划停役时间']= df.apply(lambda x:start_time(x['停役日期'],x['停复役时间']),axis = 1)\n",
    "df['计划复役时间']= df.apply(lambda x:stop_time(x['停役日期'],x['停复役时间']),axis = 1)\n",
    "df.head(3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 101,
   "metadata": {},
   "outputs": [
    {
     "output_type": "stream",
     "name": "stdout",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\nInt64Index: 97 entries, 1 to 117\nData columns (total 10 columns):\n #   Column  Non-Null Count  Dtype         \n---  ------  --------------  -----         \n 0   周计划编号   97 non-null     object        \n 1   计划停役时间  97 non-null     datetime64[ns]\n 2   计划复役时间  97 non-null     datetime64[ns]\n 3   停役日期    97 non-null     datetime64[ns]\n 4   停复役时间   97 non-null     object        \n 5   厂站名称    97 non-null     object        \n 6   主要工作内容  97 non-null     object        \n 7   申请单位    97 non-null     object        \n 8   备注      97 non-null     object        \n 9   申请单编号   97 non-null     object        \ndtypes: datetime64[ns](3), object(7)\nmemory usage: 10.8+ KB\n"
     ]
    }
   ],
   "source": [
    "df.info()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 154,
   "metadata": {},
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": [
       "Timestamp('2021-03-01 16:00:00')"
      ]
     },
     "metadata": {},
     "execution_count": 154
    }
   ],
   "source": [
    "def jf(b):\n",
    "    return b[1]-b[0]\n",
    "# df['k'] = df[['计划复役时间','计划停役时间']].apply(lambda x:jf,axis = 1)\n",
    "# for i in df[['计划复役时间','计划停役时间']]:\n",
    "#     print(i)\n",
    "# # df['k']\n",
    "df[['计划复役时间','计划停役时间']].loc[1,'计划复役时间']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 162,
   "metadata": {},
   "outputs": [
    {
     "output_type": "error",
     "ename": "ValueError",
     "evalue": "key of type tuple not found and not a MultiIndex",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mValueError\u001b[0m                                Traceback (most recent call last)",
      "\u001b[0;32m<ipython-input-162-6c1654d0b4d7>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m      1\u001b[0m \u001b[0mf\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mdf\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mgroupby\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'申请单编号'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'申请单编号'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcount\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m>\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m \u001b[0mf\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
      "\u001b[0;32m/opt/anaconda3/lib/python3.8/site-packages/pandas/core/series.py\u001b[0m in \u001b[0;36m__getitem__\u001b[0;34m(self, key)\u001b[0m\n\u001b[1;32m    904\u001b[0m             \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_get_values\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    905\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 906\u001b[0;31m         \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_get_with\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m    907\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    908\u001b[0m     \u001b[0;32mdef\u001b[0m \u001b[0m_get_with\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mkey\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m/opt/anaconda3/lib/python3.8/site-packages/pandas/core/series.py\u001b[0m in \u001b[0;36m_get_with\u001b[0;34m(self, key)\u001b[0m\n\u001b[1;32m    919\u001b[0m             )\n\u001b[1;32m    920\u001b[0m         \u001b[0;32melif\u001b[0m \u001b[0misinstance\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtuple\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 921\u001b[0;31m             \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_get_values_tuple\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m    922\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    923\u001b[0m         \u001b[0;32melif\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0mis_list_like\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m/opt/anaconda3/lib/python3.8/site-packages/pandas/core/series.py\u001b[0m in \u001b[0;36m_get_values_tuple\u001b[0;34m(self, key)\u001b[0m\n\u001b[1;32m    954\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    955\u001b[0m         \u001b[0;32mif\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0misinstance\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mindex\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mMultiIndex\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 956\u001b[0;31m             \u001b[0;32mraise\u001b[0m \u001b[0mValueError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"key of type tuple not found and not a MultiIndex\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m    957\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    958\u001b[0m         \u001b[0;31m# If key is contained, would have returned by now\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;31mValueError\u001b[0m: key of type tuple not found and not a MultiIndex"
     ]
    }
   ],
   "source": [
    "f = df.groupby('申请单编号')['申请单编号'].count()>1\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ]
}